//package com.zy.oauth.shiro;
//
//import org.apache.shiro.authc.AuthenticationException;
//import org.apache.shiro.authc.AuthenticationInfo;
//import org.apache.shiro.authc.AuthenticationToken;
//import org.apache.shiro.authc.pam.ModularRealmAuthenticator;
//import org.apache.shiro.realm.Realm;
//
//public class DataAuthModularRealmAuthenticator extends ModularRealmAuthenticator {
//    @Override
//    protected AuthenticationInfo doAuthenticate(AuthenticationToken authenticationToken) throws AuthenticationException {
//        assertRealmsConfigured();
//        DataAuthToken dataAutoToken = (DataAuthToken) authenticationToken;
//
//        Realm realm = getRealm(dataAutoToken);
//        return doSingleRealmAuthentication(realm, authenticationToken);
//    }
//
//    private Realm getRealm(DataAuthToken dataAutoToken) {
//        for (Realm realm : getRealms()) {
//            // 根据定义的realm的name和dataAutoToken的name匹配相应的realm
//            if (realm.getName().contains(dataAutoToken.getName())) {
//                return realm;
//            }
//        }
//        return null;
//    }
//
//}
